package com.lx.pc.restful.tendering;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.lx.pc.domain.vo.tendering.TenderingVo;
import com.lx.pc.restful.BaseController;
import com.lx.pc.service.tendering.ITenderingService;
import com.lx.pc.utils.OmsPage;

/**
 * 招标
 * @author houzhong
 *
 */
@Controller
public class TenderingController extends BaseController{

	@Resource(name = "tenderingService")
	private ITenderingService tenderingService;
	
	/**
	 * 招投标页面
	 * @return
	 */
	@RequestMapping(value = "/toTenderingtList.do")
	public ModelAndView toTenderingtList() {
		ModelAndView mv = new ModelAndView("/tendering/tendering_list");
		return mv;
	}
	
	/**
	 * 招投标列表
	 * @param v
	 * @param page
	 * @param size
	 * @return
	 * @throws IOException
	 */
	@RequestMapping("/tenderingtList.do")
	@ResponseBody
    public  String tenderingtList(TenderingVo v,Integer page,Integer size) throws IOException {
        Map<String,Object> result = new HashMap<String, Object>();
        OmsPage<TenderingVo> pages = tenderingService.findByTendering(v, page, size);
        result.put("tendering", pages);
        return JSON.toJSONString(result);
    }
}
